/*程序初始化
Created on 2020年05月10日
@author: zxyong 13738196011
 */

package com.zxy.main;

import java.util.Hashtable;
import java.util.List;

import com.zxy.business.Ope_DB_Cent;
import com.zxy.common.Cal_Auto_Run;
import com.zxy.common.Com_Para;
import com.zxy.common.DbConfigSelf;
import com.zxy.db1.DBManager1;
import com.zxy.db1.PooledConnection1;
import com.zxy.db10.DBManager10;
import com.zxy.db10.PooledConnection10;
import com.zxy.db2.DBManager2;
import com.zxy.db2.PooledConnection2;
import com.zxy.db3.DBManager3;
import com.zxy.db3.PooledConnection3;
import com.zxy.db4.DBManager4;
import com.zxy.db4.PooledConnection4;
import com.zxy.db5.DBManager5;
import com.zxy.db5.PooledConnection5;
import com.zxy.db6.DBManager6;
import com.zxy.db6.PooledConnection6;
import com.zxy.db7.DBManager7;
import com.zxy.db7.PooledConnection7;
import com.zxy.db8.DBManager8;
import com.zxy.db8.PooledConnection8;
import com.zxy.db9.DBManager9;
import com.zxy.db9.PooledConnection9;
import com.zxy.model.T_DB_CONFIG;

public class Init_Page
{
	// 读取初始加载信息
	public static void Init_Load()
	{
		DbConfigSelf.GetDbConfigSelfNew();
		// 业务子系统数据库操作
		Ope_DB_Cent opd = new Ope_DB_Cent();
		List<T_DB_CONFIG> tdc = opd.Get_T_DB_CONFIG();
		for(T_DB_CONFIG tdvv: tdc)
		{
			if(Com_Para.htDb != null && Com_Para.htDb.get(String.valueOf(tdvv.getMAIN_ID())) == null)
				Com_Para.htDb.put(String.valueOf(tdvv.getMAIN_ID()),tdvv);
		}

		for(T_DB_CONFIG td: tdc)
		{
			try
			{
				switch(td.getMAIN_ID())
				{
					case 1:
						DBManager1.bUse = true;
						PooledConnection1 conn1 = DBManager1.getConnection();
						conn1.returnConnection();
						break;
					case 2:
						DBManager2.bUse = true;
						PooledConnection2 conn2 = DBManager2.getConnection();
						conn2.returnConnection();
						break;
					case 3:
						DBManager3.bUse = true;
						PooledConnection3 conn3 = DBManager3.getConnection();
						conn3.returnConnection();
						break;
					case 4:
						DBManager4.bUse = true;
						PooledConnection4 conn4 = DBManager4.getConnection();
						conn4.returnConnection();
						break;
					case 5:
						DBManager5.bUse = true;
						PooledConnection5 conn5 = DBManager5.getConnection();
						conn5.returnConnection();
						break;
					case 6:
						DBManager6.bUse = true;
						PooledConnection6 conn6 = DBManager6.getConnection();
						conn6.returnConnection();
						break;
					case 7:
						DBManager7.bUse = true;
						PooledConnection7 conn7 = DBManager7.getConnection();
						conn7.returnConnection();
						break;
					case 8:
						DBManager8.bUse = true;
						PooledConnection8 conn8 = DBManager8.getConnection();
						conn8.returnConnection();
						break;
					case 9:
						DBManager9.bUse = true;
						PooledConnection9 conn9 = DBManager9.getConnection();
						conn9.returnConnection();
						break;
					case 10:
						DBManager10.bUse = true;
						PooledConnection10 conn10 = DBManager10.getConnection();
						conn10.returnConnection();
						break;
				}
			}
			catch(Exception es)
			{
				es.printStackTrace();
			}
		}
		opd.Init_Load();

		Cal_Auto_Run.init_data();
	}
}